<!DOCTYPE html>
<html>
    <head>
        <title>
            数组升序
        </title>
        <script>
        var arr=[1,4,3,9,7,5,8];
       function fun(){
        document.write(arr.sort(function(a,b){return a - b;}))
       }    
        fun(arr);
    
        </script>
    </head>
    <body>
    
    </body>
</html>